package hr.fer.android.petdroid;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class DroidActivity extends Activity {
    /** Called when the activity is first created. */
	
	
	ImageView gameHeader;
	
    @Override

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.menulayout);
        
        
		gameHeader = (ImageView) findViewById(R.id.gameHeader);
        
        
        
        Animation anim = AnimationUtils.loadAnimation(this, R.anim.anim);
        
        gameHeader.startAnimation(anim);
        
        
        final Button newGameButton = (Button) findViewById(R.id.newGameButton);
		final Button quitButton = (Button) findViewById(R.id.quitButton);
		
		// postavljanje akcija na gumbe
		
		newGameButton.setOnClickListener( 
						new Button.OnClickListener() {
						public void onClick(View v) {
							startNewGame();
						}
						
			}
		);
		
		
		
		quitButton.setOnClickListener( 
						new Button.OnClickListener(){
							public void onClick(View v){
								finish();
							}
						}
		
		);
        
        
        
    }
    
    public void startNewGame(){
    	 Intent newGameActivity = new Intent(this, ActiveDroid.class);
    		startActivity(newGameActivity);
    }
    
    public boolean onCreateOptionsMenu(Menu menu) {
    	/* ovdje se kreira meni koji se poziva tipkom MENU, potrebno je 
    	 * prvo pozvati konstruktor superklase to je linija super.onCreateOptionsMenu(Menu)*/
    	
        super.onCreateOptionsMenu(menu);
        
        /* poslije toga se dodaju gumbi u meni sa funkcijom menu.add()*/
        
        menu.add(0,1,0,"About DroidPet");
        menu.add(0,2,0,"Credits");
        
        return true;
    }
    
    public boolean onOptionsItemSelected(MenuItem item){
    	super.onOptionsItemSelected( item );
    	switch (item.getItemId()) {
    	case 1:
    		return true;
    	case 2:
    		return true;
    	
    	}
    	
    	return false;
    }
     
    
    public boolean onTouchEvent(MotionEvent event) {
    	
    	super.onTouchEvent( event ); 	
    	
    	return false;
    }
}